// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 添加短链 POST /links/generate */
export async function addUrlRelateUsingPost(
  body: API.UrlRelateAddRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseUrlRelateAddVo_>('/v1/links/generate', {
    method: 'POST',
    data: body,
    ...(options || {}),
  });
}

/** 删除短链 POST /api/short_link/delete */
export async function deleteUrlRelateUsingPost(
  linksId: number,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>(`/v1/links/remove/${linksId}`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/** 根据短链获取长链 GET /v1/links/Restore */
export async function getUrlRelateVoByShortLinkUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  body: API.UrlRelateRestoreRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseRestoreUserVo_>('/v1/links/Restore', {
    method: 'POST',
    data: body,
    ...(options || {}),
  });
}


/** 分页获取短链列表 GET /links/view */
export async function listUrlRelateVoByPageUsingPost(
  params?: API.UrlRelateQueryRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageUrlVo_>('/v1/links/view', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 发布短链 PUT /links/publish */
export async function updateUrlRelateUsingPost(
  body: API.UrlRelateUpdateRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/v1/links/publish', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}


/** 编辑短链 PUT /v1/links/edit */
export async function editUrlRelateUsingPost(
  body: API.UrlRelateUpdateRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean_>('/v1/links/edit', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

